package javase_class_250903;

/**
 * ClassName: PersonTest
 * Package: javase_class_250903
 * Description:
 *
 * @Author harkjeans
 * @Create 2025/9/3 17:20
 * @Version 1.0
 */
public class PersonTest {
    public static void main(String[] args) {
        Person p1 = new Person("hark", 25);
        p1.getInfo();
    }
}

class Person{
    private String name;
    private int age;

     public Person(String name, int age){
         this.name = name;
         this.age = age;
     }

     public void setName(String name){
         this.name = name;
     }
     public void setAge(int age){
         this.age = age;
     }
     public void getInfo(){
         System.out.println("姓名：" + name);
         speak();
     }
    public void speak(){
        System.out.println("年龄：" + age);
    }
}
